<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/4/6
 * Time: 20:55
 */


require_once "../../php/config/config.php";
require_once "../model/adminDb.php";
$AdminDb=new AdminDb();
$name = $_POST['name'];
$pass = $_POST['password'];
$addtime = time();
$pass = md5($pass);


$_SESSION['id']=1;
$data = $AdminDb->login($name, $pass);

if ($data) {

    $_SESSION['name']=$name;

    $dat = array(
        "message" => "登录成功",
        "code" => 200,
    );
    echo json_encode($dat);
} else {
    $dat = array(
        "message" => "登录失败",
        "code" => "404",
    );
    echo json_encode($dat);
}